{% extends 'model/adminbase.html' %}
{% block title %}修改处罚机制{% endblock %}
{% block script %}

<script>
     $(function () {
           {% for fine in fines %}
            $("#delete{{ fine.id }}").click(function () {
                $.ajax({
                    url: '/admin_class_fine_ajax/',
                    way: 'GET',
                    data:{id: "{{ fine.id }}", way:"fine"},
                    success:function (data) {
                        if (data === "ok"){
                            $("#tr{{ fine.id }}").hide({duration:300});
                        }else{
                            alert(data)
                        }
                    },
                    error:function () {
                        alert("操作失败")
                    }

                })
            })
         {% endfor %}

     })
</script>
{% endblock %}

{% block content %}

  <div class="row">
          <div class="col-12">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">修改处罚机制</h3>

                <div class="card-tools">

                </div>
              </div>
              <!-- /.card-header -->
              <div class="card-body table-responsive p-0" style="height: 540px;margin-top: 20px">
                <table class="table table-hover table-head-fixed text-nowrap">
                  <thead>
                    <tr>
                      <th>逾期天数上限</th>
                      <th>处罚金额</th>
                        <th>操作</th>
                    </tr>
                  </thead>
                  <tbody>
                    {% for fine in fines %}
                        <tr id="tr{{ fine.id }}">
                          <td>{{ fine.LimitDay }}</td>
                            <td>{{ fine.FineMoney }}</td>
                        <td>
                        <a target="_blank" href="{% url 'fine_mdf' fine.id %}"><button  class="btn btn-outline-primary btn-sm" >编辑</button></a>

                            <button id="delete{{ fine.id }}" class="btn btn-outline-danger btn-sm" style="margin-left: 10px">删除</button>
                        </td>
                    </tr>
                    {% endfor %}
                  </tbody>
                </table>
              </div>
              <!-- /.card-body -->
            </div>
            <!-- /.card -->
          </div>
        </div>
{% endblock %}


